package com.icangya.DAO.impl;

import com.icangya.DAO.IFbUserAwardRecordDAO;
import com.icangya.domain.FbUserAwardRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public class FbUserAwardRecordDAOImpl extends  BaseDAO<FbUserAwardRecord> implements IFbUserAwardRecordDAO {

    Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public FbUserAwardRecord getUserAwardById(long id,String openId) {
        String hql="FROM FbUserAwardRecord mr where  mr.id=? and mr.openId=?";
        List<FbUserAwardRecord> list= (List<FbUserAwardRecord>) getHibernateTemplate().find(hql,id,openId);
        if(list.size()>0)
            return list.get(0);
        return null;
    }

    @Override
    public List<FbUserAwardRecord> getUserAwardRecord(String openId) {
        String hql="FROM FbUserAwardRecord mr where  mr.openId=?";
        List<FbUserAwardRecord> list= (List<FbUserAwardRecord>) getHibernateTemplate().find(hql,openId);
        if(list.size()>0)
            return list;
        return null;
    }
}
